package 刷题10月.动态规划;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test {
    public static void main(String[] args) {
        String str = "A.123B.154";
        String pattern = "/[A-Z][\\.|．]|[\\(|][A-Z][\\)|]/";

        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(str);
        System.out.println(m);
        System.out.println(m.matches());
        System.out.println(extractMessageByRegular("（250000）"));
    }
    public static String extractMessageByRegular(String msg) {
        String s = null;
       // Pattern p = Pattern.compile("(\\(|（).*(\\)|）)");
        Pattern p = Pattern.compile("([(（]).*([)）])");
        Matcher m = p.matcher(msg);
        while (m.find()) {
            s = m.group().substring(1, m.group().length() - 1);
        }
        return s;
    }
//————————————————
//    版权声明：本文为CSDN博主「IT的鱼」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
//    原文链接：https://blog.csdn.net/qq_32521313/article/details/105359431
}
